﻿using System.Linq;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;

namespace AzureTableStorage
{
    public class AzureTableStorageServiceContext : TableServiceContext
    {
        public const string UserEntityName = "UserEntity";
        public const string RoleEntityName = "RoleEntity";
        public const string SessionStateEntityName = "SessionStateEntity";

        public AzureTableStorageServiceContext(string baseAddress, StorageCredentials credentials)
            : base(baseAddress, credentials)
        {
        }

        public IQueryable<UserEntity> Users
        {
            get
            {
                return CreateQuery<UserEntity>(UserEntityName);
            }
        }

        public IQueryable<RoleEntity> Roles
        {
            get
            {
                return CreateQuery<RoleEntity>(RoleEntityName);
            }
        }

        public IQueryable<SessionStateEntity> SessionState
        {
            get
            {
                return CreateQuery<SessionStateEntity>(SessionStateEntityName);
            }
        }

    }
}